﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Exp
{
    public partial class ToolWindow : Form
    {

        public ToolWindow()
        {
            InitializeComponent();
            this.AutoImageAddress.Text = Setting.AutoImage;
            this.HtmlSiteAddress.Text = Setting.HtmlSite;
        }

        string GetControlText(Control C)
        {
            return C.Text;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Setting.AutoImage = GetControlText(AutoImageAddress);
            Setting.HtmlSite = GetControlText(HtmlSiteAddress);
            DialogResult = DialogResult.OK;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            ofd.AutoUpgradeEnabled = true;
            var r = ofd.ShowDialog(this);
            if (r == DialogResult.OK)
                AutoImageAddress.Text = ofd.FileName;
        }
    }

    public class Setting
    {
        public static string AutoImage;
        public static string HtmlSite;
    }
}
